using System.IO;
using System.Web.UI;
using System.Web.UI.Design;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

namespace Library.WebControls.SimpleSpinEdit {
	public class SpSpinEditDesign : ControlDesigner {
		public override string GetDesignTimeHtml() {
			var pe = (SpSpinEdit)Component;
			return GetDesignTimeHtml(pe);
		}

		internal static string GetDesignTimeHtml(SpSpinEdit pe) {
			var sw = new StringWriter();
			var html = new HtmlTextWriter(sw);
			pe.CreateCssLink().RenderControl(html);
			var span = new HtmlGenericControl("span");


			var textBox = new TextBox();
			textBox.MergeStyle((pe.TextEdit.ControlStyle));
			textBox.Text = pe.TextEdit.Text;
			span.Controls.Add(textBox);
			span.RenderControl(html);

			return sw.ToString();
		}
	}
}